#include <conio.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

void tang1(int,int);
void tang2(int,int);
int main(){
do{
    //lan 1
    system("cls");
    tang1(4,2);
    tang2(1,14);
    Sleep(20);
    //lan 2
    system("cls");
    tang1(2,14);
    tang2(4,1);
    Sleep(20);
    //lan 3
    system("cls");
    tang1(14,1);
    tang2(2,4);
    Sleep(20);
    //lan 4
    system("cls");
    tang1(1,4);
    tang2(14,2);
    Sleep(20);
    }while (!kbhit());

}

void tang1(int a,int b){
    HANDLE h = GetStdHandle( STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(h,a);
    printf("* * * * *");  //1
    SetConsoleTextAttribute(h,b);
    printf("       *\n");//4
    SetConsoleTextAttribute(h,a);
    printf("  * * * *");  //1
    SetConsoleTextAttribute(h,b);
    printf("     * *\n");//4
    SetConsoleTextAttribute(h,a);
    printf("    * * *");  //1
    SetConsoleTextAttribute(h,b);
    printf("   * * *\n");//4
    SetConsoleTextAttribute(h,a);
    printf("      * *");  //1
    SetConsoleTextAttribute(h,b);
    printf(" * * * *\n");//4
}

void tang2(int a, int b){
    HANDLE h = GetStdHandle( STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(h,a);
    printf("* * * * *");//2
    SetConsoleTextAttribute(h,b);
    printf(" * * * *\n");//3
    SetConsoleTextAttribute(h,a);
    printf("* * * *");//2
    SetConsoleTextAttribute(h,b);
    printf(" * *\n");//3
    SetConsoleTextAttribute(h,a);
    printf("* * *"); //2
    SetConsoleTextAttribute(h,b);
    printf("   * * *\n");//3
    SetConsoleTextAttribute(h,a);
    printf("* *");  //2
    SetConsoleTextAttribute(h,b);
    printf("     * * * *\n");//3
    SetConsoleTextAttribute(h,a);
    printf("*");   //2
    SetConsoleTextAttribute(h,b);
    printf("       * * * * *\n");//3
}
